/**
 * Copyrigth 2007 Aurelien Moreau
 * 
 * This file is part of ProcessShop.
 * 
 * ProcessShop is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * ProcessShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with ProcessShop; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * $Id$
 */
package net.yienyien.process.dfm.impl;

import java.util.Collection;

import net.yienyien.process.dfm.DataActivity;
import net.yienyien.process.dfm.DataFlow;
import net.yienyien.process.dfm.DataLink;
import net.yienyien.process.dfm.DfmPackage;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Data Flow</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link net.yienyien.process.dfm.impl.DataFlowImpl#getDataActivities <em>Data Activities</em>}</li>
 *   <li>{@link net.yienyien.process.dfm.impl.DataFlowImpl#getDataLinks <em>Data Links</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DataFlowImpl extends EObjectImpl implements DataFlow {
	/**
	 * The cached value of the '{@link #getDataActivities() <em>Data Activities</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDataActivities()
	 * @generated
	 * @ordered
	 */
	protected EList<DataActivity> dataActivities;

	/**
	 * The cached value of the '{@link #getDataLinks() <em>Data Links</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDataLinks()
	 * @generated
	 * @ordered
	 */
	protected EList<DataLink> dataLinks;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DataFlowImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DfmPackage.Literals.DATA_FLOW;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<DataActivity> getDataActivities() {
		if (dataActivities == null) {
			dataActivities = new EObjectContainmentEList<DataActivity>(DataActivity.class, this, DfmPackage.DATA_FLOW__DATA_ACTIVITIES);
		}
		return dataActivities;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<DataLink> getDataLinks() {
		if (dataLinks == null) {
			dataLinks = new EObjectContainmentEList<DataLink>(DataLink.class, this, DfmPackage.DATA_FLOW__DATA_LINKS);
		}
		return dataLinks;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case DfmPackage.DATA_FLOW__DATA_ACTIVITIES:
				return ((InternalEList<?>)getDataActivities()).basicRemove(otherEnd, msgs);
			case DfmPackage.DATA_FLOW__DATA_LINKS:
				return ((InternalEList<?>)getDataLinks()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case DfmPackage.DATA_FLOW__DATA_ACTIVITIES:
				return getDataActivities();
			case DfmPackage.DATA_FLOW__DATA_LINKS:
				return getDataLinks();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case DfmPackage.DATA_FLOW__DATA_ACTIVITIES:
				getDataActivities().clear();
				getDataActivities().addAll((Collection<? extends DataActivity>)newValue);
				return;
			case DfmPackage.DATA_FLOW__DATA_LINKS:
				getDataLinks().clear();
				getDataLinks().addAll((Collection<? extends DataLink>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case DfmPackage.DATA_FLOW__DATA_ACTIVITIES:
				getDataActivities().clear();
				return;
			case DfmPackage.DATA_FLOW__DATA_LINKS:
				getDataLinks().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case DfmPackage.DATA_FLOW__DATA_ACTIVITIES:
				return dataActivities != null && !dataActivities.isEmpty();
			case DfmPackage.DATA_FLOW__DATA_LINKS:
				return dataLinks != null && !dataLinks.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //DataFlowImpl
